<template>
		<view class="item">
			<image :src="$myRequire(this.food.iconPath)" class="icon"></image>
			
			<view class="detail">
				<view class="name">{{ food.name }}</view>
				
				<u-rate v-model="food.stars" :disabled="true" inactive-color="#d7deeb" size="29"></u-rate>
			
				<view class="detail-1">
					<view>{{ food.addr }}</view>
					<text class="stauts" :class="status_style">{{ status_flag }}</text>
				</view>
				
				<view class="detail-2">
					<u-tag v-for="item in food.tag" 
						:key="item.id"
						:text="item.tag"
						type="info"
						size="mini" 
						class="tag"
						shape="circle">
					</u-tag>
				</view>
			</view>
		</view>
</template>

<script>	
	export default {
		name: "food-item",
		props: {
			"food": Object
		},
		computed: {
			status_flag() {
				return this.food.open ? "营业中" : "暂停营业";
			},
			status_style() {
				return this.food.open ? "status_1" : "status_2";
			}
		}
	}	
</script>

<style scoped>
	.item{
		width: 720rpx;
		box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, 
					rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
		border-radius: 6px;
		padding: 30rpx;
		margin-top: 25rpx;
		display: flex;
		background-color: #FFFFFF;
	}
	
	.icon{
		width: 110rpx;
		height: 110rpx;
		border-radius: 7px;
	}
	
	.detail{
		width: calc(100% - 110rpx);
		padding: 0 30rpx;
		font-size: 13px;
	}
	
	.detail view{
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}
	
	.name{
		font-weight: 700;
		font-size: 18px;
	}
	
	.detail-1{
		display: flex;
		justify-content: space-between;
	}
	
	.stauts{
		padding-right: 10rpx;
	}
	
	/* 状态为：暂停营业的样式 */
	.status_1{
		color: #00b386;
	}
	
	/* 状态为：营业中的样式 */
	.status_2{
		color: #696969;
	}
	
	.detail-2{
		border-top: 1px solid #E6E6FA;
		margin-top: 10rpx;
		padding-top: 10rpx;
	}
	
	.tag{
		margin: 5rpx;
	}
</style>
